package com.sugar.psych.assessment.module.business.controller.app.basicconfig;

import com.sugar.psych.assessment.framework.common.pojo.CommonResult;
import com.sugar.psych.assessment.framework.common.util.object.BeanUtils;
import com.sugar.psych.assessment.module.business.controller.admin.basicconfig.vo.BasicConfigRespVO;
import com.sugar.psych.assessment.module.business.service.basicconfig.BasicConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;

import static com.sugar.psych.assessment.framework.common.pojo.CommonResult.successApp;

@Tag(name = "APP - 基本配置")
@RestController
@RequestMapping("/psych/basic-config")
@Validated
public class AppBasicConfigController {

    @Resource
    private BasicConfigService basicConfigService;

    @GetMapping("/get")
    @Operation(summary = "获得基本配置")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    @PermitAll
    public CommonResult<BasicConfigRespVO> getBasicConfig() {
        return successApp(BeanUtils.toBean(basicConfigService.getBasicConfig(1L), BasicConfigRespVO.class));
    }
}